#include <stdio.h>

int main(int argc, char *argv[])
{

    int n = 0;
    scanf("%d", &n);
    int numa[n];
    for (size_t i = 0; i < n; i++)
    {
        scanf("%d", &numa[i]);
    }

    int r = 0;
    scanf("%d", &r);
    int numb[r];
    for (size_t i = 0; i < r; i++)
    {
        scanf("%d", &numb[i]);
    }

    int allSize = n + r;

    int allNums[allSize];

    int index = 0, tempInd = 0;

    while (1)
    {
        if(index<n){
            allNums[index] = numa[index];
        }else if (index>=n&&index<allSize)
        {
            allNums[index] = numb[tempInd++];
        }else{
            break;
        }
        index++;
    }

    //冒泡排序
    for (size_t i = 0; i < allSize; i++)
    {
        for (size_t z = i+1; z < allSize; z++)
        {
            int temp = allNums[i];

            if(allNums[i]<allNums[z]){
                allNums[i] = allNums[z];
                allNums[z] = temp;
            }
        }
        
    }

    for (size_t i = 0; i < allSize; i++)
    {
        printf("%d ", allNums[i]);
    }


    return 0;
}

